import request from '@/utils/request';
import { AxiosPromise } from 'axios';
import { meetingRoomVO, meetingRoomForm, meetingRoomQuery } from '@/api/efficient-office/meeting-room-facility/types';

/**
 * 查询会议室-设施列表
 * @param query
 * @returns {*}
 */

export const listMeetingRoomFacility = (query?: meetingRoomQuery): AxiosPromise<meetingRoomVO[]> => {
  return request({
    url: '/meeting-room/meeting-room-facility/list',
    method: 'get',
    params: query
  });
};
export const equipmentInfoList = (meetingRoomId: string | number): AxiosPromise<meetingRoomVO> => {
  return request({
    url: '/equipment/equipment-info/list?' + 'groupId=' + meetingRoomId,
    method: 'get'
  });
};

/**
 * 查询会议室-设施详细
 * @param meetingRoomFacilityId
 */
export const getMeetingRoomFacility = (meetingRoomFacilityId: string | number): AxiosPromise<meetingRoomVO> => {
  return request({
    url: '/meeting-room/meeting-room-facility/' + meetingRoomFacilityId,
    method: 'get'
  });
};

/**
 * 新增会议室-设施
 * @param data
 */
export const addMeetingRoomFacility = (data: meetingRoomForm) => {
  return request({
    url: '/meeting-room/meeting-room-facility',
    method: 'post',
    data: data
  });
};

/**
 * 修改会议室-设施
 * @param data
 */
export const updateMeetingRoomFacility = (data: meetingRoomForm) => {
  return request({
    url: '/meeting-room/meeting-room-facility',
    method: 'put',
    data: data
  });
};

/**
 * 删除会议室-设施
 * @param meetingRoomFacilityId
 */
export const delMeetingRoomFacility = (meetingRoomFacilityId: string | number | Array<string | number>) => {
  return request({
    url: '/meeting-room/meeting-room-facility/' + meetingRoomFacilityId,
    method: 'delete'
  });
};
